package com.xbongbong.pro.statistic.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * 系统图表的SystemCode枚举（BOARD后缀是简报看板，HOME后缀是首页，CHART后缀是图表中心）
 * 系统指标注释枚举
 *
 * @author 曹远远
 * @version v1.0
 * @date 2020/6/15
 * @since v1.0
 */
@Getter
public enum SystemCodeAnnotateEnum {
    /**
     * 客户
     */
    //简报看板客户总数
    CUSTOMER_TOTAL_BOARD(IndicatorRuleEnum.CUSTOMER_TOTAL.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.customer_total_board", "enum.systemCodeAnnotate.timeAttr.customer_total_board","enum.systemCodeAnnotate.timeRange.customer_total_board","","",""),
    //简报看板新增客户
    CUSTOMER_ADD_HOME_BOARD(IndicatorRuleEnum.CUSTOMER_ADD.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.customer_add_home_board", "enum.systemCodeAnnotate.timeAttr.customer_add_home_board","enum.systemCodeAnnotate.timeRange.customer_add_home_board","enum.systemCodeAnnotate.include.customer_add_home_board","",""),
    //简报看板跟进客户数
    CUSTOMER_FOLLOW_BOARD(IndicatorRuleEnum.CUSTOMER_FOLLOW.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.customer_follow_board", "enum.systemCodeAnnotate.timeAttr.customer_follow_board","enum.systemCodeAnnotate.timeRange.customer_follow_board","","",""),
    /**
     * 简报看板合同订单数
     */
    CONTRACT_COUNT_BOARD(IndicatorRuleEnum.CONTRACT_COUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.contract_count_board", "enum.systemCodeAnnotate.timeAttr.contract_count_board","enum.systemCodeAnnotate.timeRange.contract_count_board","","",""),

    /**
     * 简报看板合同订单金额
     */
    CONTRACT_AMOUNT_BOARD(IndicatorRuleEnum.CONTRACT_AMOUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.contract_amount_board", "enum.systemCodeAnnotate.timeAttr.contract_amount_board","enum.systemCodeAnnotate.timeRange.contract_amount_board","","","enum.systemCodeAnnotate.memo.contract_amount_board"),
    /**
     * 简报看板应收余额
     */
    PAYMENT_UN_BOARD(IndicatorRuleEnum.PAYMENT_UN.getCode() + "_01","enum.systemCodeAnnotate.belongAttr.payment_un_board", "enum.systemCodeAnnotate.timeAttr.payment_un_board","enum.systemCodeAnnotate.timeRange.payment_un_board","","","enum.systemCodeAnnotate.memo.payment_un_board"),
    /**
     * 简报看板计划收款
     */
    PAYMENT_TASK_BOARD(SystemCodeEnum.PAYMENT_TASK_BOARD.getSystemCode(),"enum.systemCodeAnnotate.belongAttr.payment_task_board", "enum.systemCodeAnnotate.timeAttr.payment_task_board","enum.systemCodeAnnotate.timeRange.payment_task_board","","","enum.systemCodeAnnotate.memo.payment_task_board"),
    /**
     * 简报看板新增销售机会
     */
    OPPORTUNITY_ADD_COUNT_BOARD(IndicatorRuleEnum.OPPORTUNITY_ADD_COUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.opportunity_add_count_board", "enum.systemCodeAnnotate.timeAttr.opportunity_add_count_board","enum.systemCodeAnnotate.timeRange.opportunity_add_count_board","","",""),
    /**
     * 简报看板跟进记录
     */
    COMMUNICATE_ADD_BOARD(IndicatorRuleEnum.COMMUNICATE_ADD.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.communicate_add_board", "enum.systemCodeAnnotate.timeAttr.communicate_add_board","enum.systemCodeAnnotate.timeRange.communicate_add_board","","",""),
    /**
     * 简报看板新增机会金额
     */
    OPPORTUNITY_ADD_AMOUNT_BOARD(IndicatorRuleEnum.OPPORTUNITY_ADD_AMOUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.opportunity_add_amount_board", "enum.systemCodeAnnotate.timeAttr.opportunity_add_amount_board","enum.systemCodeAnnotate.timeRange.opportunity_add_amount_board","","",""),
    /**
     * 简报看板采购合同
     */
    PURCHASE_COUNT_BOARD(IndicatorRuleEnum.PURCHASE_COUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.purchase_count_board", "enum.systemCodeAnnotate.timeAttr.purchase_count_board","enum.systemCodeAnnotate.timeRange.purchase_count_board","","",""),
    /**
     * 简报看板采购金额
     */
    PURCHASE_AMOUNT_BOARD(IndicatorRuleEnum.PURCHASE_AMOUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.purchase_amount_board", "enum.systemCodeAnnotate.timeAttr.purchase_amount_board","enum.systemCodeAnnotate.timeRange.purchase_amount_board","","",""),
    /**
     * 付款计划
     */
    PAY_UN_BOARD(IndicatorRuleEnum.PAY_UN.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.pay_un_board", "enum.systemCodeAnnotate.timeAttr.pay_un_board","enum.systemCodeAnnotate.timeRange.pay_un_board","","",""),

    /**
     * 当前库存成本
     */
    PRODUCT_COST_BOARD(IndicatorRuleEnum.PRODUCT_COST.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.product_cost_board", "enum.systemCodeAnnotate.timeAttr.product_cost_board","enum.systemCodeAnnotate.timeRange.product_cost_board","","enum.systemCodeAnnotate.warehouseCost.product_cost_board",""),

    /**
     * 报价单数量
     */
    QUOTATION_COUNT(IndicatorRuleEnum.QUOTATION_COUNT.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.quotation_count", "enum.systemCodeAnnotate.timeAttr.quotation_count","enum.systemCodeAnnotate.timeRange.quotation_count","","","enum.systemCodeAnnotate.memo.quotation_count"),

    /**
     * 报价金额
     */
    QUOTATION_AMOUNT(IndicatorRuleEnum.QUOTATION_AMOUNT.getCode() + "_01","enum.systemCodeAnnotate.belongAttr.quotation_amount","enum.systemCodeAnnotate.timeAttr.quotation_amount","enum.systemCodeAnnotate.timeRange.quotation_amount","","","enum.systemCodeAnnotate.memo.quotation_amount"),

    /**
     * 报价转换率
     */
    QUOTATION_CONVERSION(IndicatorRuleEnum.QUOTATION_CONVERSION.getCode() + "_01","enum.systemCodeAnnotate.belongAttr.quotation_conversion","enum.systemCodeAnnotate.timeAttr.quotation_conversion","enum.systemCodeAnnotate.timeRange.quotation_conversion","","","enum.systemCodeAnnotate.memo.quotation_conversion"),

    /**
     * 简报看板 当前线索数
     */
    //简报看板客户总数
    CLUR_TOTAL_BOARD(IndicatorRuleEnum.CLUE_TOTAL.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.clue_total_board", "enum.systemCodeAnnotate.timeAttr.clue_total_board","enum.systemCodeAnnotate.timeRange.clue_total_board","","",""),
    //简报看板新增客户
    CLUR_ADD_HOME_BOARD(IndicatorRuleEnum.CLUE_ADD.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.clue_add_home_board", "enum.systemCodeAnnotate.timeAttr.clue_add_home_board","enum.systemCodeAnnotate.timeRange.clue_add_home_board","","",""),
    //简报看板跟进客户数
    ClUE_FOLLOW_BOARD(IndicatorRuleEnum.CLUE_FOLLOW.getCode() + "_01", "enum.systemCodeAnnotate.belongAttr.clue_follow_board", "enum.systemCodeAnnotate.timeAttr.clue_follow_board","enum.systemCodeAnnotate.timeRange.clue_follow_board","","",""),


    UNKNOWN("404", "", "","","","",""),
    ;
    /**
     * 对应数据库的SystemCode
     */
    private String systemCode;
    /**
     * 归属人
     */
    private String belongAttr;
    /**
     * 统计时间
     */
    private String timeAttr;
    /**
     * 计入区间
     */
    private String timeRange;
    /**
     * 包含
     */
    private String include;

    /**
     * 当前库存成本
     */
    private String warehouseCost;

    /**
     * 备注
     */
    private String memo;

    SystemCodeAnnotateEnum(String systemCode, String belongAttr, String timeAttr,String timeRange,String include,String warehouseCost,String memo) {
        this.systemCode = systemCode;
        this.belongAttr = belongAttr;
        this.timeAttr = timeAttr;
        this.timeRange = timeRange;
        this.include = include;
        this.warehouseCost = warehouseCost;
        this.memo = memo;
    }
    public String getBelongAttr() {
        return I18nMessageUtil.getMessage(belongAttr);
    }

    public String getTimeAttr() {
        return I18nMessageUtil.getMessage(timeAttr);
    }

    public String getTimeRange() {
        return I18nMessageUtil.getMessage(timeRange);
    }

    public String getInclude() {
        return I18nMessageUtil.getMessage(include);
    }

    public String getWarehouseCost(){
        return I18nMessageUtil.getMessage(warehouseCost);
    }

    public String getMemo(){
        return I18nMessageUtil.getMessage(memo);
    }

    /**
     * 通过枚举<code>code</code>获得枚举
     *
     * @param code
     * @return SystemCodeEnum
     */
    public static SystemCodeAnnotateEnum getByCode(String code) {
        for (SystemCodeAnnotateEnum cacheCode : values()) {
            if (Objects.equals(cacheCode.getSystemCode(), code)) {
                return cacheCode;
            }
        }
        return UNKNOWN;
    }

}
